#include "trap.h"
#include "inst_test.h"
#include "asm/regdef.h"
#include "asm/asm.h"
    .set noreorder
    .set noat 
    .global main 
    .text 

    main:

    ori $t0, $zero, 0x7FFF      # $t0 = 0x7FFF
    lui $t1, 0xFFFF             # $t1 = 0xFFFF0000
    add $t2, $t0, $t1           # $t2 = $t0 + $t1
    xor $t3, $t2, $t0           # $t3 = $t2 ^ $t0
    sll $t4, $t3, 15            # $t4 = $t3 << 15
    addu $t5, $t4, $t1          # $t5 = $t4 + $t1
    lb $t6, 0($t1)              # Load byte from address $t1
    sb $t6, 1($t0)              # Store byte at address $t0 + 1
    beq $t0, $t5, skip5         # Branch if $t0 == $t5
    bne $t0, $t5, continue5     # Branch if $t0 != $t5
skip5:
    ori $t7, $zero, 0           # $t7 = 0
continue5:


    HIT_GOOD_TRAP

inst_error:
    HIT_BAD_TRAP